<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/8
  Time: 16:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>客户新建</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="${pageContext.request.contextPath}/customer/update" method="post">
    <div style="background: #f3ff4f"><h2>公司信息</h2></div>
    <input type="hidden" name="id" value="${customer.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">客户名称</label>
        <div class="layui-input-inline">
            <%--lay-verify="required" 表示表单验证，必填--%>
            <input type="text" name="name" value="${customer.name}" lay-verify="required" placeholder="客户名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">公司电话</label>
            <div class="layui-input-inline">
                <input type="text" name="company_phone" value="${customer.company_phone}" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户状态</label>
            <div class="layui-input-inline">
                <select name="status" lay-search="">
                    <option value="">请选择</option>
                    <option value="潜在客户" <c:if test="${customer.status=='潜在客户'}">selected</c:if>>潜在客户</option>
                    <option value="成交客户" <c:if test="${customer.status=='成交客户'}">selected</c:if>>成交客户</option>
                    <option value="意向客户" <c:if test="${customer.status=='意向客户'}">selected</c:if>>意向客户</option>
                    <option value="失败客户" <c:if test="${customer.status=='失败客户'}">selected</c:if>>失败客户</option>
                    <option value="已流失客户" <c:if test="${customer.status=='已流失客户'}">selected</c:if>>已流失客户</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">意向产品</label>
            <div class="layui-input-inline">
                <input type="text" name="product_id " value="${customer.product_id}"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户类别</label>
            <div class="layui-input-inline">
                <select name="type" lay-search="">
                    <option value="">请选择</option>
                    <option value="普通客户" <c:if test="${customer.type=='普通客户'}">selected</c:if>>普通客户</option>
                    <option value="VIP客户" <c:if test="${customer.type=='VIP客户'}">selected</c:if>>VIP客户</option>
                    <option value="老客户" <c:if test="${customer.type=='老客户'}">selected</c:if>>老客户</option>
                    <option value="代理商" <c:if test="${customer.type=='代理商'}">selected</c:if>>代理商</option>
                    <option value="供货商" <c:if test="${customer.type=='供货商'}">selected</c:if>>供货商</option>
                    <option value="合作伙伴" <c:if test="${customer.type=='合作伙伴'}">selected</c:if>>合作伙伴</option>
                    <option value="其他" <c:if test="${customer.type=='其他'}">selected</c:if>>其他</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户来源</label>
            <div class="layui-input-inline">
                <select name="source"  lay-search="">
                    <option value="">请选择</option>
                    <option value="注册会员" <c:if test="${customer.source=='注册会员'}">selected</c:if> >注册会员</option>
                    <option value="朋友介绍" <c:if test="${customer.source=='朋友介绍'}">selected</c:if>>朋友介绍</option>
                    <option value="客户介绍" <c:if test="${customer.source=='客户介绍'}">selected</c:if>>客户介绍</option>
                    <option value="电子商务" <c:if test="${customer.source=='电子商务'}">selected</c:if>>电子商务</option>
                    <option value="合作伙伴" <c:if test="${customer.source=='合作伙伴'}">selected</c:if>>合作伙伴</option>
                    <option value="广告" <c:if test="${customer.source=='广告'}">selected</c:if>>广告</option>
                    <option value="职员引介" <c:if test="${customer.source=='职员引介'}">selected</c:if>>职员引介</option>
                    <option value="市场活动" <c:if test="${customer.source=='市场活动'}">selected</c:if>>市场活动</option>
                    <option value="口头传达" <c:if test="${customer.source=='口头传达'}">selected</c:if>>口头传达</option>
                    <option value="其他" <c:if test="${customer.source=='其他'}">selected</c:if>>其他</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户等级</label>
            <div class="layui-input-inline">
                <select name="levels"  lay-search="">
                    <option value="">请选择</option>
                    <option value="五星客户" <c:if test="${customer.levels=='五星客户'}">selected</c:if>>五星客户</option>
                    <option value="四星客户" <c:if test="${customer.levels=='四星客户'}">selected</c:if>>四星客户</option>
                    <option value="三星客户" <c:if test="${customer.levels=='三星客户'}">selected</c:if>>三星客户</option>
                    <option value="二星客户" <c:if test="${customer.levels=='二星客户'}">selected</c:if>>二星客户</option>
                    <option value="一星客户" <c:if test="${customer.levels=='一星客户'}">selected</c:if>>一星客户</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户信用度</label>
            <div class="layui-input-inline">
                <select name="credit"  lay-search="">
                    <option value="">请选择</option>
                    <option value="五星客户" <c:if test="${customer.credit=='五星客户'}">selected</c:if>>五星客户</option>
                    <option value="四星客户" <c:if test="${customer.credit=='四星客户'}">selected</c:if>>四星客户</option>
                    <option value="三星客户" <c:if test="${customer.credit=='三星客户'}">selected</c:if>>三星客户</option>
                    <option value="二星客户" <c:if test="${customer.credit=='二星客户'}">selected</c:if>>二星客户</option>
                    <option value="一星客户" <c:if test="${customer.credit=='一星客户'}">selected</c:if>>一星客户</option>
                </select>
            </div>
        </div>
    </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户成熟度</label>
            <div class="layui-input-inline">
                <select name="maturity"  lay-search="">
                    <option value="">请选择</option>
                    <option value="明确交易意向" <c:if test="${customer.maturity=='明确交易意向'}">selected</c:if>>A+：明确交易意向</option>
                    <option value="有初步成交意向" <c:if test="${customer.maturity=='有初步成交意向'}">selected</c:if>>A-：有初步成交意向</option>
                    <option value="关键人有成交意向" <c:if test="${customer.maturity=='关键人有成交意向'}">selected</c:if>>B+：关键人有成交意向</option>
                    <option value="关键人成交意向不确定" <c:if test="${customer.maturity=='关键人成交意向不确定'}">selected</c:if>>B-：关键人成交意向不确定</option>
                    <option value="初步联系，有意向" <c:if test="${customer.maturity=='初步联系，有意向'}">selected</c:if>>C+：初步联系，有意向</option>
                    <option value="初步联系，意向不明确" <c:if test="${customer.maturity=='初步联系，意向不明确'}">selected</c:if>>C-：初步联系，意向不明确</option>
                    <option value="新建客户" <c:if test="${customer.maturity=='新建客户'}">selected</c:if>>D：新建客户</option>
                    <option value="有明显拒绝" <c:if test="${customer.maturity=='有明显拒绝'}">selected</c:if>>E：有明显拒绝</option>
                    <option value="无效客户" <c:if test="${customer.maturity=='无效客户'}">selected</c:if>>F：无效客户</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">所在地址</label>
            <div class="layui-input-inline">
                <input type="text" name="area" value="${customer.area}"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">邮政编码</label>
            <div class="layui-input-inline">
                <input type="text" name="post_code" value="${customer.post_code}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">详细地址</label>
        <div class="layui-input-block">
            <input type="text" name="company_address" value="${customer.area}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <%--    <div class="layui-form-item">
            <label class="layui-form-label">相关文件</label>
            <div class="layui-input-inline">
                <input type="file" name="headpic" value="${customer.headpic}">
            </div>
        </div>--%>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">客户介绍</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">传真地址</label>
            <div class="layui-input-inline">
                <input type="text" name="fax_address"  value="${customer.fax_address}"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">公司网址</label>
            <div class="layui-input-inline">
                <input type="text" name="company_website"  value="${customer.company_website}"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">法人</label>
            <div class="layui-input-inline">
                <input type="text" name="corporation"  value="${customer.corporation}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">开户银行</label>
            <div class="layui-input-inline">
                <input type="text" name="deposit_bank"  value="${customer.deposit_bank}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">银行账号</label>
        <div class="layui-input-block">
            <input type="text" name="bank_account"  value="${customer.bank_account}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年营业额</label>
        <div class="layui-input-block">
            <input type="text" name="annual_sale"  value="${customer.annual_sale}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">营业执照注册号</label>
        <div class="layui-input-block">
            <input type="text" name="license_number"  value="${customer.license_number}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地税登记号</label>
        <div class="layui-input-block">
            <input type="text" name="land_tax_number"  value="${customer.land_tax_number}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">国税登记号</label>
        <div class="layui-input-block">
            <input type="text" name="national_tax_number"  value="${customer.national_tax_number}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <input type="submit" style="margin-left: 100px"lay-filter="update" lay-submit class="layui-btn" value="保存">
    </div>
</form>
<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    layui.use(['layer','form','jquery'],function () {
        var layer=layui.layer
            , form=layui.form;
        var $=layui.$;
        //异步提交表单
        form.on("submit(update)",function (data) {
            $.post("${pageContext.request.contextPath}/customer/update",data.field,function (result) {
                if (result.code==0){
                    layer.msg("修改成功!");
                    //刷新父窗口内容
                    parent.layui.table.reload("roleTable", {
                        page:{
                             curr:1
                         }
                     }
                    )
                    //关闭弹窗
                    var index=parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                }
            },"json")
            // return false;//阻止默认表单提交
        })
    });
</script>
</body>
</html>
